package com.dao;

import com.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Repository
public class DepartmentDao {
    /*模拟一个数据库出来*/
    private static Map<Integer, Department> departmentMap=null;
    static {
        departmentMap=new HashMap<Integer, Department>();
        departmentMap.put(101,new Department(101,"教学楼"));
        departmentMap.put(102,new Department(102,"营销部"));
        departmentMap.put(103,new Department(103,"市场部"));
        departmentMap.put(104,new Department(104,"保安部"));
        departmentMap.put(105,new Department(105,"策划部"));
    }
    /*模拟CRUD操作*/
    public Collection<Department> findAll(){
        return departmentMap.values();
    }
    public Department findById(Integer id){
        return departmentMap.get(id);
    }

}
